Repository navigation
feat(domains): add forge activation methods - #262
lucasfcosta wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 5 files
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
There was a problem hiding this comment.
0 issues found across 1 file (changes from recent commits).
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Requires human review: Auto-approval blocked by 1 unresolved issue from previous reviews.
View guided diff | Re-trigger cubic
There was a problem hiding this comment.
0 issues found across 2 files (changes from recent commits).
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Requires human review: Auto-approval blocked by 1 unresolved issue from previous reviews.
View guided diff | Re-trigger cubic
3fc2fc8 to
1b59b6e
Compare
There was a problem hiding this comment.
0 issues found across 2 files (changes from recent commits).
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Requires human review: Auto-approval blocked by 1 unresolved issue from previous reviews.
View guided diff | Re-trigger cubic
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1b59b6e to
202a61c
Compare
There was a problem hiding this comment.
0 issues found across 2 files (changes from recent commits).
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Requires human review: Auto-approval blocked by 1 unresolved issue from previous reviews.
View guided diff | Re-trigger cubic
Matches the reshaped API: Domains::Forge keeps only enable (return_path optional), Domains.verify gains an optional scope: ["forge"] that re-checks only the Forge record, and Domains.update accepts forge_return_path to move the Forge return path without starting verification. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
2 issues found across 4 files (changes from recent commits).
Confidence score: 4/5
- The Forge-provider examples in
spec/domains_spec.rbexercise domain update and verification calls alongside API-key permission checks. Confirm the SDK methods and permissions those tests rely on are supported. - The verification examples in
spec/domains_spec.rbdepend on API-key state from earlier examples, so they fail when run alone. ConfigureResendlocally for those examples.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="spec/domains_spec.rb">
<violation number="1" location="spec/domains_spec.rb:214">
P3: This example depends on API-key state left by earlier examples, so it fails when run by itself (for example, while debugging this line). Add a local `Resend.configure` setup for the verification examples, or move the configuration to the outer `Domains` group.</violation>
<violation number="2" location="spec/domains_spec.rb:303">
P2: Custom agent: **API Key Permission Check SDK Methods**
These tests exercise new Forge provider operations — PATCH `domains/:id` with `forge_return_path` and POST `domains/:id/verify` with `scope: ["forge"]` — plus the new `/domains/:id/forge` endpoints in `lib/resend/domains/forge.rb`. Per the API-key permission checklist, confirm the API keys used in production have the required permissions for these new operations before deploying, to avoid permission-related failures.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
| expect { Resend::Domains.verify }.not_to raise_error | ||
| end | ||
|
|
||
| it "verifies only the Forge record when scoped" do |
There was a problem hiding this comment.
P2: Custom agent: API Key Permission Check SDK Methods
These tests exercise new Forge provider operations — PATCH domains/:id with forge_return_path and POST domains/:id/verify with scope: ["forge"] — plus the new /domains/:id/forge endpoints in lib/resend/domains/forge.rb. Per the API-key permission checklist, confirm the API keys used in production have the required permissions for these new operations before deploying, to avoid permission-related failures.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At spec/domains_spec.rb, line 303:
<comment>These tests exercise new Forge provider operations — PATCH `domains/:id` with `forge_return_path` and POST `domains/:id/verify` with `scope: ["forge"]` — plus the new `/domains/:id/forge` endpoints in `lib/resend/domains/forge.rb`. Per the API-key permission checklist, confirm the API keys used in production have the required permissions for these new operations before deploying, to avoid permission-related failures.</comment>
<file context>
@@ -278,5 +299,21 @@
expect { Resend::Domains.verify }.not_to raise_error
end
+
+ it "verifies only the Forge record when scoped" do
+ resp = {
+ "object": "domain",
</file context>
| forge_return_path: "outbound" | ||
| } | ||
|
|
||
| expect(Resend::Request).to receive(:new) |
There was a problem hiding this comment.
P3: This example depends on API-key state left by earlier examples, so it fails when run by itself (for example, while debugging this line). Add a local Resend.configure setup for the verification examples, or move the configuration to the outer Domains group.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At spec/domains_spec.rb, line 214:
<comment>This example depends on API-key state left by earlier examples, so it fails when run by itself (for example, while debugging this line). Add a local `Resend.configure` setup for the verification examples, or move the configuration to the outer `Domains` group.</comment>
<file context>
@@ -199,6 +199,27 @@
+ forge_return_path: "outbound"
+ }
+
+ expect(Resend::Request).to receive(:new)
+ .with("domains/479e3145-dd38-476b-932c-529ceb705947", update_params, "patch")
+ .and_call_original
</file context>
Summary
Adds Forge activation, matching the folded API surface (the standalone forge verify and update endpoints no longer exist). Ports resend/resend-node#1193 to Ruby; the API surface is defined in resend/resend-openapi#144.
Resend::Domains::Forge.enable(id:, return_path:)→POST /domains/:id/forge. Returns the full domain response.return_pathis optional; when omitted, the API picks a label that is free in the domain's DNS, and onlyreturn_pathis ever sent in the body. Idempotent on the API side.Resend::Domains.verify(domain_id, scope: ["forge"])→POST /domains/:id/verifywith{"scope":["forge"]}. Scoped, only the Forge record is re-checked, so the records that are already verified are not re-proven. The existingverify(domain_id)call still sends{}exactly as before.Resend::Domains.update({ id: ..., forge_return_path: ... })→PATCH /domains/:id.forge_return_pathpasses through like every other update field: moves the Forge return path while the Forge record is still verifying, does not start verification, and once the record verifies the API refuses with 422return_path_unavailable.Bumps the version to 1.20.0.
Validation
bundle exec rubocop: 52 files inspected, no offenses detected.bundle exec rake spec: 484 examples, 0 failures (Ruby 3.3).return_path(empty body asserted), the scoped verify body, and theforge_return_pathPATCH body.Notes for reviewers
verifykeeps its positionaldomain_idand takes the scope as a trailing params hash, so existing callers are untouched.Forge.enablesends onlyreturn_path(params.slice(:return_path)), so theidused to build the path never leaks into the payload.Part of DEV-2474.
The Forge enable endpoint is live in production; the scoped verify and
forge_return_pathland with the API reshape, which deploys before this ships. Ships with the next resend-ruby release.